<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>图书管理</title>
    <%--静态包含base标签、css样式、jQuery库--%>
    <%@include file="/pages/common/header.jsp" %>
</head>
<script type="text/javascript">
    $(function () {
        /*当前图书点击删除按钮后弹出提示框是否确认删除操作*/
        $("a.deleteClass").click(function () {
            return confirm("确定删除[" + $(this).parent().parent().find("td:first").text() + "]吗？")
        })
    })
</script>

<body>

<div id="header">
    <img class="logo_img" alt="" src="static/img/logo.png">
    <span class="wel_word">图书管理系统</span>
    <%--静态包含管理模块菜单信息--%>
    <%@include file="/pages/common/manage_menu.jsp" %>
</div>

<div id="main">
    <table>
        <tr>
            <td>名称</td>
            <td>价格</td>
            <td>作者</td>
            <td>销量</td>
            <td>库存</td>
            <td colspan="2">操作</td>
        </tr>
        <c:forEach items="${requestScope.pageBook.items}" var="pageBook">
            <tr>
                <td>${pageBook.name}</td>
                <td>${pageBook.price}</td>
                <td>${pageBook.author}</td>
                <td>${pageBook.sales}</td>
                <td>${pageBook.stock}</td>
                <td>
                    <a href="manager/bookServlet?action=queryBookById&id=${pageBook.id}&pageNo=${requestScope.pageBook.pageNo}">修改</a>
                </td>
                <td><a class="deleteClass"
                       href="manager/bookServlet?action=deleteBook&id=${pageBook.id}&pageNo=${requestScope.pageBook.pageNo}">删除</a>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td>
                <a href="<%=request.getContextPath()%>/pages/manager/book_edit.jsp?pageTotal=${requestScope.pageBook.pageTotal}">添加图书</a>
            </td>
        </tr>
    </table>
    <%--静态包含分页导航条--%>
    <%@include file="/pages/common/page_pilot.jsp" %>
</div>

<%--静态包含页脚信息--%>
<%@include file="/pages/common/footer.jsp" %>
</body>
</html>